package com.luyu.req;

import com.luyu.customvalid.HumanGroupSequenceProvider;
import com.luyu.group.HumanGroup;
import com.luyu.group.PetGroup;
import jakarta.validation.GroupSequence;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.groups.ConvertGroup;
import lombok.Data;
import org.hibernate.validator.group.GroupSequenceProvider;

/**
 * @author luYu
 */
@Data
@GroupSequenceProvider(HumanGroupSequenceProvider.class)
public class Human {

    @NotEmpty(message = "名称",groups = {HumanGroup.class})
    private String name;


    @NotEmpty(message = "位置",groups = {HumanGroup.class})
    private String location;


    @NotEmpty(message = "国家",groups = {HumanGroup.class})
    private String country;

    @NotNull(message = "人必须有宠物",groups = {PetGroup.class,HumanGroup.class})
    @Valid
    @ConvertGroup.List(value = {
            @ConvertGroup(from=HumanGroup.class,to=PetGroup.class)
    })
    private Pet pet;




    private Boolean humanFlag;

}
